<!--添加读者-->
<html>
<head>
    <meta charset="utf-8">
    <title>添加读者</title>

    <style>
        body{
            background-color: rgb(240,242,245);
        }
    </style>

</head>
<body>

<div class="col-xs-6 col-md-offset-3" style="position: relative;top: 25%">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">添加读者</h3>
        </div>
        <div class="panel-body">
            <form method="post" id="readeredit" >
                <div class="input-group">
                    <span  class="input-group-addon">读者证号</span>
                    <input  type="text" class="form-control" name="reader_id" id="reader_id" >
                </div>

                <div class="input-group">
                    <span class="input-group-addon">姓名</span>
                    <input type="text" class="form-control" name="name" id="name"  >
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">性别</span>
                    <input type="text" class="form-control" name="sex" id="sex" >
                </div>
                <div class="input-group">
                    <span class="input-group-addon">生日</span>
                    <input type="date" class="form-control" name="birth" id="birth"  >
                </div>
                <div class="input-group">
                    <span  class="input-group-addon">地址</span>
                    <input type="text" class="form-control" name="address" id="address"  >
                </div>
                <div class="input-group">
                    <span class="input-group-addon">电话</span>
                    <input type="text" class="form-control" name="telcode" id="telcode"  >
                </div>
                <input id="reader_btn" type="submit" value="添加" class="btn btn-success btn-sm" class="text-left">

            </form>
        </div>
    </div>

</div>

<script>
    $("#reader_btn").click(function () {
        $.ajax({
            type:"post",
            dataType:"json",
            url:"user/addReader",
            data:$("#readeredit").serialize(),
            success:function(data) {
                if (!data) {
                    alert("用户已存在")
                }else {
                    alert("用户已添加")
                    // location.href = "admin_readers.html";
                    $("#middle").load("admin_readers.html");
                }
            }
        })
        return false;
    })
</script>
</body>
</html>
